package io.renren.modules.person.controller;

import io.renren.common.utils.R;
import io.renren.modules.person.model.Person;
import io.renren.modules.person.service.PersonService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author A夜兔A
 * @data 2021年11月16日 17:35
 */
@RestController
@RequestMapping("/personmanager")
public class PersonController {

    @Autowired
    private PersonService personService;

    @ApiOperation("获得VIP客户信息")
    @GetMapping("/getVIP")
    public R getVIP(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                    @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
                    @RequestParam(value = "keyword",defaultValue = "")String keyword){
        return personService.getVIP(pageNum,pageSize,keyword);
    }

    @ApiOperation("添加VIP")
    @PostMapping("/addVIP")
    public R addVIP(@RequestBody Person person){
        return personService.addVIP(person);
    }

    @ApiOperation("更新VIP信息")
    @PostMapping("/updateVIP")
    public R updateVIP(@RequestBody Person person){
        return personService.updateVIP(person);
    }

    @ApiOperation("删除VIP")
    @PostMapping("delVIP")
    public R delVIP(@RequestBody Person person){
        return personService.delVIP(person);
    }

}
